/*---------------------------------------------------------------------------------

	by GugloPWN

---------------------------------------------------------------------------------*/

#include "map.h"




void map::readmap(char path[64])
{
}

void map::getdefaultmap()
{
	int i,j;
	
	for(i=0;i<5;i++)
	{
		for(j=0;j<5;j++)
		{
			blks[i][j] = new block();
			//printf("\nloaded block %d %d",i,j);
		}
	}
	
	for(i=0;i<5;i++)
	{
		blks[i][0]-> getnullblock();
		blks[0][i]-> getnullblock();
		blks[i][4]-> getnullblock();
		blks[4][i]-> getnullblock();
	}
	
	printf("\nreading blocks");
	blks[2][2]->readblock("demo0202");
	blks[2][3]->readblock("demo0203");
	blks[3][3]->readblock("demo0303");
	blks[3][2]->readblock("demo0302");
	blks[3][1]->readblock("demo0301");
	blks[2][1]->readblock("demo0201");
	blks[1][1]->readblock("demo0101");
	blks[1][2]->readblock("demo0102");
	blks[1][3]->readblock("demo0103");
}

void map::loadmapmodels()
{
	int i,j;
	
	for(i=0;i<16;i++)
	{
		for(j=0;j<16;j++)
		{
		}
	}
}

void map::drawmap(int mx, int my)
{
	//glLoadIdentity();
	
	//the block the player is in
	blks[mx][my]->drawblock();
	
	//the blocks at right angles to the players
	glTranslatef(2,0,0);
	blks[mx+1][my]->drawblock();
	glTranslatef(-4,0,0);
	blks[mx-1][my]->drawblock();
	glTranslatef(2,2,0);
	blks[mx][my+1]->drawblock();
	glTranslatef(0,-4,0);
	blks[mx][my-1]->drawblock();
	
	
	//the blocks on the diagnals
	glTranslatef(2,4,0);
	blks[mx+1][my+1]->drawblock();
	glTranslatef(-4,0,0);
	blks[mx-1][my+1]->drawblock();
	glTranslatef(0,-4,0);
	blks[mx-1][my-1]->drawblock();
	glTranslatef(4,0,0);
	blks[mx+1][my-1]->drawblock();
	

}

void map::drawmapcolmap(int mx, int my)
{
	//glLoadIdentity();
	
	//the block the player is in
	blks[mx][my]->drawblockcolmap();
	/*
	//the blocks at right angles to the players
	glTranslatef(2,0,0);
	blks[mx+1][my]->drawblockcolmap();
	glTranslatef(-4,0,0);
	blks[mx-1][my]->drawblockcolmap();
	glTranslatef(2,2,0);
	blks[mx][my+1]->drawblockcolmap();
	glTranslatef(0,-4,0);
	blks[mx][my-1]->drawblockcolmap();
	*/
	/*
	//the blocks on the diagnals
	glTranslatef(2,4,0);
	blks[mx+1][my+1]->drawblockcolmap();
	glTranslatef(-4,0,0);
	blks[mx-1][my+1]->drawblockcolmap();
	glTranslatef(0,-4,0);
	blks[mx-1][my-1]->drawblockcolmap();
	glTranslatef(4,0,0);
	blks[mx+1][my-1]->drawblockcolmap();
	*/
	
	/*
	//the blocks at right angles to the players
	glTranslatef(2,0,0);
	blks[mx+1][my]->drawblockcolmap();
	glTranslatef(-4,0,0);
	blks[mx-1][my]->drawblockcolmap();
	glTranslatef(2,2,0);
	blks[mx][my+1]->drawblockcolmap();
	glTranslatef(0,-4,0);
	blks[mx][my-1]->drawblockcolmap();
	
	//the blocks on the diagnals
	glTranslatef(2,4,0);
	blks[mx+1][my+1]->drawblockcolmap();
	glTranslatef(-4,0,0);
	blks[mx-1][my+1]->drawblockcolmap();
	glTranslatef(0,-4,0);
	blks[mx-1][my-1]->drawblockcolmap();
	glTranslatef(4,0,0);
	blks[mx+1][my-1]->drawblockcolmap();
	*/

}
/*
void map::updatemap()
{
	p1->updateplayer();
	p1->setplayercam();
	//glLoadIdentity();
	//gluLookAt(  0, 0, 1,	//camera possition 
	//			2, 2, 0,				//look at
	//			0.0, 0.0, 1.0);	
				
}*/






